package com.yuch.controller;

import com.yuch.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author YUCH
 */
@RestController
@RequestMapping("/books")
public class BookController {

    @Autowired
    private BookService bookService;
//
//    @GetMapping
//    public R<List<Book>> getAll() {
//        List<Book> list = bookService.list();
//        return R.success(list);
//
//    }
//
//    @PostMapping
//    public R save(@RequestBody Book book) {
//        boolean flag = bookService.save(book);
//        return flag ? R.success("保存成功") : R.error("保存失败");
//    }
//
//    @PutMapping
//    public R<String> update(@RequestBody Book book) {
//        boolean b = bookService.updateById(book);
//        return b?R.success("修改成功"):R.error("修改失败");
//    }
//
//    @DeleteMapping("{id}")
//    public R delete(@PathVariable Integer id) {
//        boolean b = bookService.removeById(id);
//        return b ? R.success("删除成功") : R.error("删除失败");
//    }
//
//        @GetMapping("{id}")
//    public R<Book> getById(@PathVariable Integer id) {
//            Book book = bookService.getById(id);
//            return R.success(book);
//
//    }


}
